package cn.chenli.job.service.impl;

import cc.tuhaolicai.mt.predefined.database.PageInfo;
import cn.chenli.job.dao.BaseDao;
import cn.chenli.job.service.BaseService;
import org.asyou.mongo.Page;

import java.util.List;

/**
 * BaseDao的实现
 *
 * @author chenli
 * @create 2017-06-13
 **/
public class BaseServiceImpl<T> implements BaseService<T> {

    protected BaseDao<T> dao;

    public void setDao(BaseDao<T> dao) {
        this.dao = dao;
    }

    @Override
    public T save(T t) {
        return dao.save(t);
    }

    @Override
    public T findOne(T t) {
        return dao.findOne(t);
    }

    @Override
    public Page<T> findPage(T t, PageInfo pageInfo) {
        return dao.findPage(t, pageInfo);
    }

    @Override
    public List<T> findAll(T t) {
        return dao.findAll(t);
    }

    @Override
    public Boolean update(T oldModel, T newModel) {
        return dao.update(oldModel, newModel);
    }

    @Override
    public Boolean delete(T t) {
        return dao.delete(t);
    }

    @Override
    public List<T> convert(List<T> list) {
        return dao.convert(list);
    }

}